import Vue from 'vue'
import Router from 'vue-router'
import routerConfig from './routerConfig'

Vue.use(Router)

export default new Router({
  mode: "history",
  base: '/',
  routes: [
    {
      path:"/",
      name:"home",
      component:()=>import("@/components/home"),
      meta:{
        title:"首页"
      },
      children:[
        {
        path:"/supply",
        name:"supply",
        component:()=>import("@/components/supply"),
        meta:{
          title:"供应信息"
        },
       },
       {
        path:"/wantToBuy",
        name:"wantToBuy",
        component:()=>import("@/components/wantToBuy"),
        meta:{
          title:"求购信息"
        },
       },
       {
        path:"/price",
        name:"price",
        component:()=>import("@/components/price"),
        meta:{
          title:"价格行情"
        },
       },
       {
        path:"/agriculture",
        name:"agriculture",
        component:()=>import("@/components/agriculture"),
        meta:{
          title:"三农资讯"
        },
       },
       {
        path:"/technology",
        name:"technology",
        component:()=>import("@/components/technology"),
        meta:{
          title:"农业技术"
        },
       },
       {
        path:"/special",
        name:"special",
        component:()=>import("@/components/special"),
        meta:{
          title:"用户管理"
        },
       },
       {
        path:"/exhibition",
        name:"exhibition",
        component:()=>import("@/components/exhibition"),
        meta:{
          title:"涉农展会"
        },
       },
     ]
    },
    ...routerConfig
  ]
})
const VueRouterPush = Router.prototype.push
Router.prototype.push = function push (to) {
  return VueRouterPush.call(this, to).catch(err => err)
}